

import tensorflow as tf
import numpy as np

pred_in = np.array([[0.7, 0.5, 0.4],
            [0.9, 0.1, 0.3],
            [0.5, 0.5, 0.6]])

y_in = np.array([[1,0,0],
        [1,0,0],
        [0,0,1]])

# y = np.array([[0,0,1],
#         [0,0,1],
#         [0,0,1]])

with tf.Session() as sess:
    pred = tf.placeholder(tf.float32,[None,None])
    y =  tf.placeholder(tf.float32,[None,None])
    correct_prediction = tf.equal(tf.argmax(pred, 1), tf.argmax(y, 1))
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

    print("acc:{}".format(sess.run(accuracy,feed_dict={pred:pred_in, y:y_in})))